// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import VueRouter from 'vue-router'
import router from './router/routes'
import Vuex from 'vuex'
import store from './vuex/store'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import Mock from './mock'
Mock.bootstrap();
import './style/login.css'
import './style/managerlogin.css'
import axios from './plugins/axios'
import moment from 'moment'




import "./static/css/bootstrap.min.css"
import './static/css/common.css'
import './static/css/corptravel.css'
import './static/css/enterprise.css'
import './static/css/iconfont.css'
import './static/css/IconOfIndex.css'







/* Vue.use(VueAxios, axios) */
Vue.use(ElementUI)
Vue.use(VueRouter)
Vue.use(Vuex)
Vue.config.productionTip = false
Vue.config.silent = true


//过滤器，防止用户直接访问一些敏感路径
router.beforeEach((to, from, next) => {
  let passenger = JSON.parse(sessionStorage.getItem('passenger'));
  if (!passenger && (to.path == '/confirmBook' || to.path == '/passenger'
      ||to.path=='/passenger/myDatail'||to.path=='/passenger/myTicket'
      ||to.path=='/passenger/myNotation'||to.path=='/passenger/myBill'
      ||to.path=='/passenger/editInfo')) {
    next({ path: '/passengerLogin' })
  } else {
    next()
  }
  let manager = JSON.parse(sessionStorage.getItem('manager'));
  if (!manager && (to.path == '/manager' || to.path == '/manager/insertFlight'
    ||to.path=='/manager/summaryFlight'||to.path=='/manager/queryFlight')) {
    next({ path: '/managerLogin' })
  } else {
    next()
  }

})

new Vue({
  render: h => h(App),
  router,
  store,
  axios,

}).$mount('#app')
